package cn.imvc.data.jpa.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import cn.imvc.data.domain.ViewRequest;

public interface IJpqlExecutor<T> {
	Page<T> findAll(ViewRequest viewRequest);

	Page<T> findAll(String select, String from, ViewRequest viewRequest);

	List<T> findAllJpql(String jpql);

	List<Object[]> findAllJpqlArray(String jpql);

	List<T> findAllJpql(String jpql, Sort sort);

	List<Object[]> findAllJpqlArray(String jpql, Sort sort);

	// 其中：Pageable接口的实现类是PageRequest，Page接口的实现类是PageImpl。
	//只返回T对象字段
	Page<T> findAllJpql(String select, String from, String where,
			Pageable pageable);
	//自定义只返回字段
	Page<Object[]> findAllJpqlArray(String select, String from, String where,
			Pageable pageable);
}
